import request from "@/utils/request";
import {baseURLMulti} from "@/setting";
const baseURL=baseURLMulti

/**
 * 获取走马灯
 * @returns {*}
 */
export function getHorse(){
  return request({
    baseURL,
    url:`/image/getHorse`,
    method:'get'
  })
}
/**
 * 添加走马灯图片
 * @returns {*}
 */
export function insertHorse(data){
  return request({
    baseURL,
    url:`/image/insertHorse`,
    method:'post',
    data
  })
}

/**
 * 分页获取文章
 * http://localhost:8001/article/getArticleByPage/1/10/1
 * @returns {*}
 */
export function getArticleByPage(page,limit,articleType){
  return request({
    baseURL,
    url:`/article/getArticleByPage/${page}/${limit}/${articleType}`,
    method:'get'
  })
}

/**
 * 根据文章id获取文章
 * @param id
 * @returns {*}
 */
export function getArticleById(id){
  return request({
    baseURL,
    url:`/article/getArticleDetail/${id}`,
    method:'get'
  })
}

/**
 * http://localhost:8001/article/getArticleByTitle/1?title=e
 * @param title 标题
 * @param articleType 文章类型
 * @returns {*}
 */
export function getArticleByTitle(title,articleType){
  return request({
    baseURL,
    url:`/article/getArticleByTitle/${articleType}`,
    method:'get',
    params:{'title':title}
  })
}

/**
 * 创建文章
 * @param data
 * @returns {*}
 */
export function createArticle(data){
  return request({
    baseURL,
    url:`/article/create`,
    method:'post',
    data
  })
}

/**
 * 删除文章
 * @param articleId 文章id
 * @returns {*}
 */
export function deleteArticle(articleId){
  return request({
    baseURL,
    url:`/article/deleteArticle/${articleId}`,
    method:'delete'
  })
}

/**
 * 批量删除文章
 * @param data 文章id集合
 * @returns {*}
 */
export function deleteArticles(data){
  return request({
    baseURL,
    url:`/article/deleteArticles`,
    method:'delete',
    data
  })
}

/**
 * 获取文章
 * @param page
 * @param limit
 * @param articleType
 * @returns {*}
 */
export function getArticleBeDeleted(page,limit,articleType){
  return request({
    baseURL,
    url:`/article/getArticleBeDeleted/${page}/${limit}/${articleType}`,
    method:'get'
  })
}

/**
 * 删除文章
 * @returns {*}
 */
export function deleteArticleBeDeleted(data){
  return request({
    baseURL,
    url:`/article/deleteArticleDeleted`,
    method:'delete',
    data
  })
}

/**
 * 获取文章
 * @param articleId
 * @returns {*}
 */
export function getDetailDeleted(articleId){
  return request({
    baseURL,
    url:`/article/getArticleBeDeleted/${articleId}`,
    method:'get'
  })
}
/**
 * 更新文章阅读量
 * https://172.118.4.117:8003/article/updateView/1
 * @param articleId
 * @returns {*}
 */
export function updateArticleView(articleId){
  return request({
    baseURL,
    url:`/article/updateView/${articleId}`,
    method:'put'
  })
}

/**
 * 分页获取当前用户的文章
 * @param userId
 * @param page
 * @param limit
 * @param articleType
 * @returns {*}
 */
export function getArticleByUserId(userId,page,limit,articleType){
  return request({
    baseURL,
    url:`/article/getArticleById/${userId}/${page}/${limit}/${articleType}`,
    method:'get'
  })
}

/**
 * 批量还原文章
 * @param data
 * @returns {*}
 */
export function recoveryArticles(data){
  return request({
    baseURL,
    url:`/article/recoverArticle`,
    method:'put',
    data
  })
}



/**
 * 插入景点文本信息
 * @param data
 * @returns {*}
 */
export function insertScenicInfo(data){
  return request({
    baseURL,
    url:`/scenic/insertScenic`,
    method:'post',
    data
  })
}


/**
 * 插入图片
 * @param data
 * @returns {*}
 */
export function insertImage(data){
  return request({
    baseURL,
    url:`/image/insertImage`,
    method:'post',
    data
  })
}

/**
 * 获取景点列表
 * @param page
 * @param limit
 * @returns {*}
 */
export function getScenic(page,limit){
  return request({
    baseURL,
    url:`/scenic/getScenic/${page}/${limit}`,
    method:'get',
  })
}

/**
 * 逻辑删除景点
 * @param page
 * @param limit
 * @returns {*}
 */

export function deleteScenic(data){
  return request({
    baseURL,
    url:`/scenic/deleteScenic`,
    method:'delete',
    data
  })
}

/**
 * 根据景点名称模糊查询景点
 * @param name
 * @returns {*}
 */
export function searchScenicList(name){
  return request({
    baseURL,
    url:`/scenic/getScenic/${name}`,
    method:'get'
  })
}

/**
 * 分页获取被逻辑删除景点
 * @param page
 * @param limit
 * @returns {*}
 */
export function getScenicListDeleted(page,limit){
  return request({
    baseURL,
    url:`/scenic/getScenicDeleted/${page}/${limit}`,
    method:'get'
  })
}

/**
 * 还原景点
 * @param data
 * @returns {*}
 */
export function recoveryScenicDeleted(data){
  return request({
    baseURL,
    url:`/scenic/recoverScenic`,
    method:'put',
    data
  })
}

/**
 * 永久删除景点
 * @param data
 * @returns {*}
 */
export function deleteScenicDeleted(data){
  return request({
    baseURL,
    url:`/scenic/deleteScenicDeleted`,
    method:'delete',
    data
  })
}

/**
 * 获取景点信息
 * @param scenicId
 * @returns {*}
 */
export function getScenicInfo(scenicId){
  return request({
    baseURL,
    url:`/scenic/getScenicInfo/${scenicId}`,
    method:'get'
  })
}
/**
 * 获取景点配图
 * @param scenicId
 * @returns {*}
 */
export function getScenicImage(scenicId){
  return request({
    baseURL,
    url:`/image/getScenicImage/${scenicId}`,
    method:'get'
  })
}

/**
 * 更新景点信息
 * @param data
 * @returns {*}
 */
export function updateScenicInfo(data){
  return request({
    baseURL,
    url:`/scenic/updateScenic`,
    method:'put',
    data
  })
}

/**
 * /deleteImage/{imageId}/{imageUrl} 永久删除图片
 * @param imageId
 * @param imageUrl
 * @returns {*}
 */
export function deleteImage(imageId,imageUrl){
  return request({
    baseURL,
    url:`/image/deleteImage/${imageId}`,
    method:'delete',
    params: {imageUrl:imageUrl}
  })
}

/**
 * getScenicAndImage/{page}/{limit}获取景点带图片
 * @param page
 * @param limit
 * @returns {*}
 */
export function getScenicAndImage(page,limit){
  return request({
    baseURL,
    url:`/scenic/getScenicAndImage/${page}/${limit}`,
    method:'get'
  })
}

//searchScenicAndImage/{name}/{page}/{limit}
export function searchScenicImage(name,page,limit){
  return request({
    baseURL,
    url:`/scenic/searchScenicAndImage/${name}/${page}/${limit}`,
    method:'get'
  })
}

/**
 * /searchScenicByType/{scenicType}/{page}/{limit}
 * @param scenicType
 * @param page
 * @param limit
 * @returns {*}
 */
export function searchScenicByType(scenicType,page,limit){
  return request({
    baseURL,
    url:`/scenic/searchScenicByType/${scenicType}/${page}/${limit}`,
    method:'get'
  })
}

/**
 * 创建旅馆
 * @param data
 * @returns {*}
 */
export function createHotel(data){
  return request({
    baseURL,
    url:`/hotel/createHotel`,
    method:'post',
    data
  })
}

/**
 * 获取酒馆列表
 * @returns {*}
 */
export function getHotelList(){
  return request({
    baseURL,
    url:`/hotel/getHotelList`,
    method:'get'
  })
}

/**
 * 删除旅馆信息
 * @param hotelId
 * @returns {*}
 */
export function deleteHotel(hotelId){
  return request({
    baseURL,
    url:`/hotel/deleteHotel/${hotelId}`,
    method:'delete'
  })
}

/**
 * 获取旅馆信息
 * @param hotelId
 * @returns {*}
 */
export function getHotelInfo(hotelId){
  return request({
    baseURL,
    url:`/hotel/getHotelInfo/${hotelId}`,
    method:'get'
  })
}

/**
 * 删除旅馆配图
 * @param hotelId
 * @returns {*}
 */
export function deleteHotelImage(hotelId){
  return request({
    baseURL,
    url:`/hotel/deleteHotelImage/${hotelId}`,
    method:'delete'
  })
}
/**
 * 更新旅馆信息
 * @param data
 * @returns {*}
 */
export function updateHotelInfo(data){
  return request({
    baseURL,
    url:`/hotel/updateHotel`,
    method:'put',
    data
  })
}

/**
 *插入反馈信息
 * @param data
 * @returns {*}
 */
export function insertNote(data){
  return request({
    baseURL,
    url:`/note/insertNote`,
    method:'post',
    data
  })
}

/**
 * 获取反馈列表
 * @param page
 * @param limit
 * @returns {*}
 */
export function getNoteList(page,limit){
  return request({
    baseURL,
    url:`/note/getNoteList/${page}/${limit}`,
    method:'get'
  })
}

/**
 * 删除留言
 * @param data
 * @returns {*}
 */
export function deleteNoteByIds(data){
  return request({
    baseURL,
    url:`/note/deleteNotes`,
    method:'delete',
    data
  })
}
